﻿//    Copyright 2014 LuoZhihui
//    Licensed under the Apache License, Version 2.0 (the "License");
//    you may not use this file except in compliance with the License.
//    You may obtain a copy of the License at
//      http://www.apache.org/licenses/LICENSE-2.0
//    Unless required by applicable law or agreed to in writing, software
//    distributed under the License is distributed on an "AS IS" BASIS,
//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//    See the License for the specific language governing permissions and
//    limitations under the License.

#region  导入名称空间

using System;
using System.ComponentModel.DataAnnotations;
using LotteryEngine.Infrastructure.Domain;

#endregion

namespace LotteryEngine.Model
{
	/// <summary>
	///     玩家抽奖记录
	/// </summary>
	public class Record : EntityBase<long>, IAggregateRoot
	{
		/// <summary>
		///     抽奖时间
		/// </summary>
		[Required]
		public virtual DateTime PlayTime { get; set; }


		/// <summary>
		///     抽奖序列号
		/// </summary>
		[StringLength(50)]
		[Required]
		public virtual string PlaySerial { get; set; }


		/// <summary>
		///     抽奖结果 true =中奖
		/// </summary>
		[Required]
		public virtual bool PlayResult { get; set; }


		/// <summary>
		///     玩家称呼/账号
		/// </summary>
		[StringLength(50)]
		[Required]
		public virtual string Player { get; set; }


		/// <summary>
		///     抽奖活动
		/// </summary>
		public virtual Sweepstake Sweepstake { get; set; }


		/// <summary>
		///     奖项
		/// </summary>
		public virtual Prize Prize { get; set; }

		public override string ToString()
		{
			return $"{Id}_{Player}_{PlaySerial}_{Sweepstake.Title}_{PlayResult}";
		}
	}
}